﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class AdminTool_AdminControl_ManageMember : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dataTable = new DataTable();
        dataTable.Columns.Add("username");
        dataTable.Columns.Add("fullname");
        dataTable.Columns.Add("email");
        dataTable.Columns.Add("phone");
        dataTable.Columns.Add("birthday");
        dataTable.Columns.Add("address");
        dataTable.Columns.Add("edit");
        dataTable.Columns.Add("delete");

        ShoppingDataContext spdt = new ShoppingDataContext();
        var mems = from p in spdt.MEMBERs
                  select p;

        foreach (var mem in mems)
        {
            DataRow row = dataTable.NewRow();
            row["username"] = mem.username;
            row["fullname"] = mem.Fullname;
            row["email"] = mem.email;
            row["phone"] = mem.phone;
            row["birthday"] = mem.birthday;
            row["address"] = mem.address;
            row["edit"] = "EditMember.aspx?username=" + row["username"];
            row["delete"] = "DeleteMember.aspx?username=" + row["username"];
            dataTable.Rows.Add(row);
        }

        memberdetail.DataSource = dataTable;
        memberdetail.DataBind();
    }
}
